package org.scmpatrol.scm;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import org.apache.commons.lang.builder.ToStringBuilder;

@Entity
@Table(name = "repository")
@NamedQuery(name = "all", query = "from SCMRepository r ")
public class SCMRepository implements Serializable {

	private static final long serialVersionUID = -785771061558974002L;

	@Id
	@GeneratedValue
	private Long id;

	private String name;
	@Lob
	private String url;
	/**
	 * The type of repository => SVN or CVS or other.<br>
	 * This is a shortcut because it have to be managed via plugins TODO Manage
	 * repository type via plugin system
	 */
	private String type;
	private String username;
	private String password;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Long getId() {
		return id;
	}

	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
	
}
